<admintpl file="header"/>
<body class="J_scroll_fixed emoji emoji">
<div class="wrap J_check_wrap">
  <ul class="nav nav-tabs">
     <li class="active"><a href="{:U('Order/index')}">订单列表</a></li>
     <li><a href="{:U('Order/statistics')}">订单统计</a></li>
     <li><a href="{:U('Order/logistics')}">物流导入</a></li>
  </ul>
  <style type="text/css">
  	.well {min-height: 55px;}
  </style>
		<form class="well form-search" method="post" action="{:U('Order/index')}">
			<div class="search_type cc mb10">
				<div class="mb10">
					<span class="mr20">
					<label class="radio" style="margin-top: 3px;">
						<input type="radio" name="radio" value='1' onclick="typeclass.style.display='block',typeID.style.display='none'" 
						<if condition="$formpost['radio'] eq 1"> checked</if>>
						<span>单选</span>
					</label>
					<label class="radio" style="margin-top: 3px;">
						<input type="radio" name="radio" value='2' onclick="typeID.style.display='block',typeclass.style.display='none'"
						<if condition="$formpost['radio'] eq 2"> checked</if>>
						<span>复选</span>
					</label>
		       <php>$i=$j=0;</php>
					<div id="typeID" style='float:left;display:<if condition="$formpost['radio'] eq 2"> block<else />none</if>;margin-top: 3px;'>
		        		<foreach name="type" item="vo">
		        			<if condition="$vo['typeID'] gt 150 && $vo['typeID'] lt 190">
		        		 	<input type="checkbox" name="typeID{$i}" value='{$vo.typeID}'style="margin-top: -2px;"
	               	<if condition="$formpost['typeID'][$i] eq $vo['typeID'] || $formpost['typeID'.$j] eq $vo['typeID']"> checked <php>$j++;</php></if>/>
	               	<span class="duoxuan">{$vo.typeName}</span><php>$i++;</php>
		        			</if>
		           </foreach>
					</div>
	              	<select id="province"name="typeclass" class="normal_select index_select" style='float:left;display:<if condition="$formpost['radio'] eq 1"> block<else />none</if>'> 
								<option value="0">全部</option>
		        		<foreach name="type" item="vo">
		        			<if condition="$formpost['typeclass'] eq $vo['typeID']">
			        			<option selected="selected" value="{$vo.typeID}">{$vo.typeName}</option>
			        			<else />
			        			<option value="{$vo.typeID}">{$vo.typeName}</option>
		        			</if>
		                </foreach>
	               	</select>
							&nbsp; &nbsp;&nbsp; &nbsp;时间：
							<input type="text" name="start_time" value="{$formpost.start_time}" class="J_date" style="width: 80px;">-
							<input type="text" name="end_time" value="{$formpost.end_time}" class="J_date" style="width: 80px;">
						<div style="margin-top: 5px;">
							订单ID：
							<input type="text" name="orderid" value="{$formpost.orderid}"  style="width: 80px;"> &nbsp; &nbsp;
							手机号：
							<input type="text" name="telephone" value="{$formpost.telephone}"  style="width: 80px;"> &nbsp; &nbsp;
							用户ID：
							<input type="text" name="userid" value="{$formpost.userid}"  style="width: 80px;"> &nbsp; &nbsp;
							<input type="submit" class="btn btn-primary" value="搜索" />
							<if condition="$num neq 0">
								共有 {$num} 条相关记录
							</if>
						</div>
					</span>
				</div>
			</div>
		</form>
<if condition="$paymoney neq 0">
以上条件共收款：{$paymoney} -- 
以上条件总价值：{$detailedmoney}
</if>
  <form class="form-horizontal J_ajaxForm" action="{:U('Order/index')}" method="post">
    <div class="table_list">
      <div class="p10"><div class="pages"> {$Page} </div> </div>
      <table width="100%" class="table table-hover">
        <thead>
          <tr>
            <th width="60px">ID</th>
            <th width="60px">手机号</th>
            <th>ID：用户昵称</th>
            <th>订单信息</th>
            <th width="60px">商品数量</th>
            <th width="60px">订单总价</th>
            <th width="60px">支付金额</th>
            <th width="120px">下单时间</th>
            <th width="60px">订单状态</th>
            <th width="110px">订单详情</th>
          </tr>
        </thead>
        <foreach name="lists" item="vo">
        	<tr>
				<td>{$vo.id}</td>
				<td>
		        <foreach name="contacts" item="contact">
					<if condition="$contact['userid'] eq $vo['userid']">
	        				{$contact.telephone}
	        				<php>break;</php>
	        		</if>
		        </foreach>
		        </td>
		        <td>
		        		<php>$d=$e=0;</php>
        		<foreach name="users" item="user">
							<if condition="$user['id'] eq $vo['userid']">
	        			{$user.id}：{$user.nickname}
	        		</if>
            </foreach>
                </td>
		        		<foreach name="detailed" item="deta">
		        			<if condition="$deta['parentID'] eq $vo['id']">
		        				<php>
		        					$d=$d+$deta['unit'];
											$e=$e+$deta['amount']*$deta['unit'];
		        				</php>
		        			</if>
		              </foreach>
									<td>{$vo.description}</td>
		              <td>{$d}</td>
		        			<foreach name="pays" item="pay">
			        			<if condition="$pay['parentID'] eq $vo['id']">
											<php>
													$p = $pay['amount'];
				        					break;
											</php>
			        			</if>
		              </foreach>
									<td <if condition="$e eq $p">style="color: #F16E1A;"</if>>
										{$e|number_format=2}￥
		              </td>
									<td <if condition="$e eq $p">style="color: #F16E1A;"</if>>
										{$p|number_format=2}￥
		              </td>
				
								<td>{$vo.created}</td>
                <td>
        			<foreach name="type" item="typ">
							<if condition="$typ['typeID'] eq $vo['status']">
									<if condition="$vo['status'] eq 150">
										<font color="#FF0150">{$typ.typeName}</font>
			        		</if>
									<if condition="$vo['status'] eq 160">
										<font color="#EAB65B">{$typ.typeName}</font>
			        		</if>
									<if condition="$vo['status'] eq 170">
										<font color="#008200">{$typ.typeName}</font>
			        		</if>
									<if condition="$vo['status'] neq 150 && $vo['status'] neq 160 && $vo['status'] neq 170">
									{$typ.typeName}
			        		</if>
		        		</if>
           		</foreach>
           		</td>
				<td>
					<a href="{:U('order/look',array('id'=>$vo['id']))}">订单内容</a>
					|
					<a href="{:U('order/detailed',array('id'=>$vo['id']))}">订单详情</a>
				</td>
			</tr>
        </foreach>
        <thead>
          <tr>
            <th width="60px">ID</th>
            <th width="60px">手机号</th>
            <th>ID：用户昵称</th>
            <th>订单信息</th>
            <th width="60px">商品数量</th>
            <th width="60px">订单总价</th>
            <th width="60px">支付金额</th>
            <th width="120px">下单时间</th>
            <th width="60px">订单状态</th>
            <th width="110px">订单详情</th>
          </tr>
        </thead>
      </table>
      <div class="p10"><div class="pages"> {$Page} </div> </div>
    </div>
  </form>
</div>
<script type="text/javascript" src="__ROOT__/statics/js/common.js"></script>
</body>
</html>